# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Darshit Shah <darnir@gmail.com>

pkgname=libpsl
pkgver=0.18.0
pkgrel=1
pkgdesc='Public Suffix List library'
url='https://github.com/rockdaboot/libpsl'
arch=('i686' 'x86_64')
license=('MIT')
depends=('icu>=59.1')
makedepends=('libxslt' 'python' 'publicsuffix-list')
source=(https://github.com/rockdaboot/libpsl/releases/download/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('ff61a6a49411ab6968cff820bccfd25b92790cd503ef2fce8e754a92af5bc9d43d224b36c60f815354022c384635eb47d56231301b36d639e86908e9cafb8cb7')

prepare() {
  cd ${pkgname}-${pkgver}
  rm -frv list
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure \
    --prefix=/usr \
    --disable-static \
    --disable-dependency-tracking \
    --enable-man \
    --enable-{builtin,runtime}=libicu \
    --with-psl-file=/usr/share/publicsuffix/effective_tld_names.dat \
    --with-psl-testfile=/usr/share/publicsuffix/test_psl.txt
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  LC_CTYPE=en_US.UTF-8 make
}

check() {
  cd ${pkgname}-${pkgver}
  make check
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 docs/libpsl/libpsl.3 -t "${pkgdir}/usr/share/man/man3"
}

# vim: ts=2 sw=2 et:
